#include "log.h"
#include <string.h>
#include "app_running.h"
#include "ota_version.h"
#include "daemon_runner.h"
#include "ota_version.h"

/**
 * @brief 入口程序
 * argv app 网关的主程序
 *      ota 网关升级程序
 *      daemon 守护进程
 *      version 查看程序当前版本
 *      update 网关主动检测更新命令
 */

int main(int argc, char *argv[])
{
    log_set_level(LOG_DEBUG);
    if (argc == 1)
    {
        printf("%s\n","请输入参数");
        return -1;
    }
    else if (strcmp(argv[1], "app") == 0)
    {
        app_running_start();
        
    }
    else if (strcmp(argv[1], "ota") == 0)
    {
        ota_check_update_daily();
        
    }
    else if (strcmp(argv[1], "daemon") == 0)
    {
        daemon_runner_start();
        
    }
    else if (strcmp(argv[1], "version") == 0)
    {
        ota_show_version();
       
    }
    else if (strcmp(argv[1], "update") == 0)
    {
        ota_check_update();
    }
    else
    {
        printf("%s\n","参数错误");
    }
    return 0;
}